package com.jrx.anytxn.transaction.job.collection.step;

import com.jrx.anytxn.transaction.entity.TlCollectionLoanList;
import com.jrx.anytxn.transaction.mapper.ext.ExtTlCollectionLoanListMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CollectionWriter implements ItemWriter<TlCollectionLoanList> {

    @Resource
    private ExtTlCollectionLoanListMapper extTlCollectionLoanListMapper;

    @Override
    public void write(List<? extends TlCollectionLoanList> items) throws Exception {
        if(CollectionUtils.isNotEmpty(items)) {
            extTlCollectionLoanListMapper.batchInsert((List<TlCollectionLoanList>) items);
        }
    }
}
